<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/17 0017
 * Time: 下午 2:06
 */
namespace app\member\validate;
class Vali_mem{
    const errmsg=[
        'username.require'      => 10001,#用户名不能为空
        'username.checkUsername'=> 10002,#用户名已存在
        'phone.checkPhone'      => 10003,#手机号码格式错误
        'phone.max'             => 10004,#手机号码不得超过11位
        'phone.checkPhoneN'     => 10005,#手机号码已被注册
        'password.require'      => 10008,#密码不能为空
        'password.min'          => 10009,#密码不能少于6位
        'password.checkPwdLogin'=> 10010,#账号不存在或密码错误
        'oldpwd.require'      => 10008,#密码不能为空
        'newpwd.require'      => 10012,#新密码不能为空
        'oldpwd.min'          => 10009,#密码不能少于6位
        'newpwd.min'          => 10013,#新密码不能少于6位
        'oldpwd.checkPwd'     => 10010,#账号不存在或密码错误
        'id.require'            => 10011,#缺少参数
        'id.checkUserId'        => 10011,#缺少参数
    ];
    public static function register(){
        $rule = [
            'username' => 'require|checkUsername',
            'phone'    => 'max:11|checkPhone|checkPhoneN'
        ];
        $message=self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
    public static function login(){
        $rule = [
            'username'  => 'require',
            'password'  => 'require|min:6|checkPwdLogin'
        ];
        $message=self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
    public static function info(){
        $rule = [
            'id'    => 'require|checkUserId',
            'phone' => 'max:11|checkPhone|checkPhoneN',
        ];
        $message =self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
    public static function _info(){
        $rule = [
            'oldpwd'  => 'require|min:6|checkPwd',
            'newpwd'  => 'require|min:6',
        ];
        $message =self::errmsg;
        return ['rule'=>$rule,'message'=>$message];
    }
}